package handlers

import (
	w "backend/pkg/webrtc"

	"github.com/gofiber/fiber/v2/log"
	"github.com/gofiber/websocket/v2"
)

func CallerConn(c *websocket.Conn) {
	// browserIdAny := c.Locals(common.ContextBrowserId)
	// browserId := browserIdAny.(string)
	peer := w.WebConn(c)
	go peer.WritePump()
	peer.ReadPump()
}

// 默认只有callee才能进行房间的创建。caller不能创建房间
func CalleeConn(c *websocket.Conn) {
	newPeer, err := w.AndroidConn(c)
	if err != nil {
		log.Error(err.Error())
		return
	}
	go newPeer.WritePump()
	newPeer.ReadPump()
}
